package com.qf.web;

import com.alibaba.fastjson.JSON;
import com.qf.pojo.Sheet;
import com.qf.service.Impl.SheetServiceImpl;
import com.qf.service.SheetService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/sheetFindAllServlet.action")
public class SheetFindAllServlet extends HttpServlet {
    SheetService sheetService = new SheetServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Sheet> sheetList = sheetService.findAll();
        String jsonSheetList = JSON.toJSONString(sheetList);
        resp.getWriter().write(jsonSheetList);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
